﻿
@{
    ViewBag.Title = "ShopStore";
    Layout = "~/Views/Shared/CommonView.cshtml";
    List<One_day.Models.T_Shop_Cart> lst = ViewBag.lst;
    var total = ViewBag.total;

}
<a style="position:fixed;top:0px;margin:5px;text-align:center" href="~/Yichen/Index">
    <img src="~/Upload/back.png" style="width:40px;height:40px;" />
</a>
<table class="table table-hover">
    <thead>
        <tr>
            <th>Id</th>
            <th>商品名称</th>
            <th>数量</th>
            <th>价钱</th>
        </tr>
    </thead>
    <tbody>
        @{
            foreach (var item in lst)
            {
                <tr class="odd gradeX">
                    <td>@item.Id</td>
                    <td>@item.ProductName</td>
                    <td>@item.Amount</td>
                    <td>@item.Total_price</td>
                </tr>
            }
        }
    </tbody>
    
</table>
<div style="float:right;margin-right:30px;">
    <label style="color:red;font-size:16px;">总计：@total</label><br />
    <button class="btn btn-primary" onclick="sub_data()">结算</button>
</div>
@section js{
    <script>
        function sub_data() {
            $.ajax({
                url: "/yichen/settle_account",//链接视图
                data: { },//传递数据
                async: true,
                type: "POST",
                success: function (result) {
                    if (result.code == 1) {
                        location.href = "/yichen/settle_success";
                    }
                    else if (result.code == 2){
                        location.href = "/user/address";
                    }
                    else if (result.code == 3) {
                        location.href="/user/personal_infor"
                    }
                    else {
                        alert(result.message);
                    }
                }
            });
        }
    </script>
    }

